<template>
  <div>
      <div class="off" @click="handleClick">
        <h2 class="iconfont icon-close-bold"></h2>
      </div>
    <div class="head">
      <div>
        <p style="text-align: center"><img src="../assets/logo.png" /></p>
        <h4>快登录</h4>
      </div>
    </div>
    <!-- 手机号码 -->
    <div>
      <van-field v-model="value" placeholder="请输入手机号码" maxlength="11" />
    </div>
    <!-- 密码框 -->
    <div>
      <van-field v-model="password" type="password" placeholder="请输入密码"/>
    </div>

    <!-- 登录框 -->
    <div>
      <van-button
      @click="handleLogin"
        round
        type="success"
        size="large"
        style="background: rgb(118, 84, 255); font-weight: 700; "
        >立即登录</van-button
      >
    </div>

    <footer>
      <p>点击立即登录表示您已阅读并同意</p>
      <p><span>《用户服务协议</span><span>《用户隐私协议》</span></p>
    </footer>
  </div>
</template>
<script>
import { ref } from "vue";

export default {
  data() {
    return {
      isChange: false,
    };
  },
  setup() {
    const value = ref("");
    return {
      value,
    };
  },
  methods: {
    handleChange() {
      this.isChange = true;
    },
    handleClick(){
      localStorage.setItem('user', 'admin')
      this.$router.back()
    },
    handleLogin () {
        sessionStorage.setItem('token', '后端返回的token字段 ')
        //  this.$router.push('/center')
        console.log(this.$route)
        this.$store.commit('handleState',true)
        this.$router.back()

    }
    }
};
</script>
<style lang="scss" scoped>

.off {
  height: 20px;
  margin: 20px;
  h2 {
    border: 1px solid #fff;
    float: right;
    font-size: 18px;
    top: -9px;
  }
}
.head {
  height: 153px;
  display: flex;
  justify-content: center;
  img {
    width: 90px;
    height: 90px;
  }
  h4 {
    text-align: center;
    font-weight: 700;
    font-size: 17px;
  }
}
footer {
  width: 100%;
  padding: 2rem 0;
  text-align: center;
  line-height: 16px;
  p {
    font-size: 11px;
    color: #95949d;
    span {
      color: #323038;
    }
  }
}
</style>
<style lang="scss">
.van-field__body {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
}
.van-field__control {
  height: 36px;
  outline: none;
  width: 100%;
  // font-size: 17px;
  // line-height: 22px;
  caret-color: #7654ff;
  color: #323038;
  border-bottom: 1px solid #eaeaea;
  padding: 13px 0;
  // margin-bottom: 17px;
}
.van-button--success {
  font-weight: 700;
}

</style>
